package rfile;

import java.io.IOException;
import java.io.RandomAccessFile;

public class RandomAccessFileMain {
	
	public static void main(String[] args) throws IOException {
		
		String s = "I love normal java.";
		String q = "jabook";
		
		RandomAccessFile rf = new RandomAccessFile(
				"raccess.txt", "rw");
		rf.writeBytes(s);
		rf.close();
		
		RandomAccessFile rf2 = new RandomAccessFile(
				"raccess.txt", "rw");
		rf2.seek(7);
		rf2.writeBytes(q);
		rf2.close();
		
		RandomAccessFile rf3 = new RandomAccessFile(
				"raccess.txt", "r");
		System.out.println(rf3.readLine());
		rf3.seek(2);
		rf3.writeBytes("hate");
		rf3.close();
		
	}
	
}




















